package cool.mtc.minghe.data.enums;

import cool.mtc.core.enums.EnumSupport;
import cool.mtc.minghe.data.entity.sys.dict.DictDO;

/**
 * @author yz
 */
public interface DictEnumSupport extends EnumSupport {

    int ordinal();

    default DictDO transToDictDO(Long dictTypeId) {
        DictDO dictDO = new DictDO();
        dictDO.setDictTypeId(dictTypeId);
        dictDO.setCode(this.name());
        dictDO.setName(this.getDesc());
        dictDO.setOrderIndex(this.ordinal() + 1);
        dictDO.setPreset(true);
        return dictDO;
    }
}
